/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

/**
 *
 * @author menderleit
 */
public class PizzaOrdre {
    private Pizza pizza;
    private int antal;
    private int size;
    
    public PizzaOrdre(Pizza p) {
        this.pizza = p;
        this.antal = 1;
        this.size = 1;
    }

    // Constructor hvor man selv kan vælge antal.
    public PizzaOrdre(Pizza p, int size, int antal) {
        this.pizza = p;
        this.antal = 1;
        if( antal > 0 ) {
            this.antal = antal;
        }
        this.size = size;
    }
    
    public void setPizza(Pizza p) {
        pizza = p;
    }
    
    // Hent pizza.
    public Pizza getPizza() {
        return pizza;
    }
    
    public int getSize() {
        return size;
    }
    
    public void setSize(int size) {
        this.size = size;
    }
    
    // Hent antal.
    public int getAntal() {
        return antal;
    }
    
    // Sæt antal pizzaer.
    public void setAntal(int antal) {
        if( antal > 0 ) {
            this.antal = antal;
        }
    }
    
    public int getPizzaSize() {
        return pizza.getPizzaId();
    }
    
    @Override
    public String toString() {
        String s;
        switch(size) {
            case 1:
                s = "Lille ";
                break;
            case 2:
                s = "Mellem ";
                break;
            case 3:
                s = "Stor ";
                break;
            default:
                s = "";
                break;
        }
        
        return s + pizza.getNavn() + " x " + antal;
    }
}
